package eoeProject.edenOfEast;

import org.apache.wicket.Page;
import org.apache.wicket.Session;
import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession;
import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;

import eoeProject.edenOfEast.core.EOEAuthenticatedWebSession;
import eoeProject.edenOfEast.page.topPage.Index;

/**
 * Application object for your web application. If you want to run this
 * application without deploying, run the Start class.
 * 
 * @see eoeProject.edenOfEast.Start#main(String[])
 */
public class WicketApplication extends AuthenticatedWebApplication {
	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	@Override
	public Class<? extends Page> getHomePage() {
		return Index.class;
	}

	/**
	 * @see org.apache.wicket.Application#init()
	 */
	@Override
	public void init() {
		super.init();
		super.mountPage("/top", eoeProject.edenOfEast.page.topPage.Index.class);
		super.mountPage("/login",
				eoeProject.edenOfEast.page.loginPage.Index.class);
		super.mountPage("/logout",
				eoeProject.edenOfEast.page.logoutPage.Index.class);
		super.mountPage("/form/input",
				eoeProject.edenOfEast.page.registerForm.Index.class);
		super.mountPage("/form/success",
				eoeProject.edenOfEast.page.registerFormSuccess.Index.class);

		super.mountPage(
				"/account/detail",
				eoeProject.edenOfEast.page.account.accountDetailPage.Index.class);

		super.mountPage("/tactics/top",
				eoeProject.edenOfEast.page.tactics.tacticsTop.Index.class);

		super.mountPage("/analyses/top",
				eoeProject.edenOfEast.page.analyses.analysesTop.Index.class);
		super.mountPage("/analyses/detail",
				eoeProject.edenOfEast.page.analyses.analysesRes.Index.class);

		super.mountPage("/archives/top",
				eoeProject.edenOfEast.page.archives.archivesTop.Index.class);

		getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
		getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
		// annotationのwicket1.5対応待ち……
		// new
		// AnnotatedMountScanner().scanPackage("eoeProject.edenOfEast.page");

	}

	@Override
	public Session newSession(Request req, Response res) {
		return new EOEAuthenticatedWebSession(req);
	}

	@Override
	public Class<? extends WebPage> getSignInPageClass() {
		// TODO 自動生成されたメソッド・スタブ
		return eoeProject.edenOfEast.page.loginPage.Index.class;
	}

	@Override
	public Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() {
		// TODO 自動生成されたメソッド・スタブ
		return EOEAuthenticatedWebSession.class;
	}
}
